package me.huanmeng.heater.command.defaults;

import me.huanmeng.heater.command.Command;
import me.huanmeng.heater.sender.Channel;
import me.huanmeng.heater.sender.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * 2021/10/5<br>
 * Heater<br>
 *
 * @author huanmeng_qwq
 */
public class ClearChatCommand extends Command {
    public ClearChatCommand() {
        super("clearchat");
    }

    @Override
    public void execute(@NotNull CommandSender sender, @Nullable Channel channel, @NotNull String label, @NotNull List<String> args) {
        if(channel!=null){
            channel.clearChat(args.isEmpty()?50:Integer.parseInt(args.get(0)));
        }else{
            sender.sendMessage("指令只能在频道中使用");
        }
    }
}
